from PIL import Image, ImageDraw

pos_boxes = [
[6.0267333984375, 1.3935699462890625, 846.218505859375, 787.8922119140625], 
[4.8516845703125, 0.3116607666015625, 848.92236328125, 800.0], 
[9.979888916015625, 0.0, 848.3609619140625, 800.0], 
[5.48114013671875, 0.0, 850.1827392578125, 800.0], 
[10.872222900390625, 0.839691162109375, 842.7908325195312, 796.1514892578125], 
[6.042266845703125, 0.0, 849.4782104492188, 800.0],  
]

neg_boxes = [
[-14.53143310546875, 15.440521240234375, 1099.341796875, 773.11572265625], 
[-6.00494384765625, 34.07073974609375, 1099.4476318359375, 777.2590942382812], 
[1.8807373046875, 19.85125732421875, 1094.809326171875, 772.9393310546875], 
[-21.078125, 34.312255859375, 1105.1259765625, 779.0333251953125], 
[-8.31756591796875, 9.396759033203125, 1098.1387939453125, 762.56396484375], 
[-1.5162353515625, 22.43316650390625, 1105.9833984375, 777.0540771484375], 
[-1.13330078125, 10.090972900390625, 1055.7294921875, 776.2115478515625], 
[-2.832733154296875, 14.923736572265625, 1096.578125, 774.7572021484375], 
[1.55328369140625, 11.240234375, 1094.482421875, 767.0383911132812], 
[5.8963623046875, 8.5843505859375, 1043.862060546875, 773.861328125], 
[4.846435546875, 8.538619995117188, 1082.023193359375, 776.4430541992188], 
[-2.97412109375, 16.284912109375, 1061.425537109375, 777.361572265625], 
[5.37835693359375, 8.4561767578125, 1075.216552734375, 786.2777099609375], 
[0.860992431640625, 10.35516357421875, 1095.396240234375, 772.681396484375], 
[-7.8924560546875, 9.270065307617188, 1095.7410888671875, 771.5504150390625], 
[9.853485107421875, 11.117385864257812, 1000.9030151367188, 790.237060546875], 
[5.3152008056640625, 4.719329833984375, 1032.3985595703125, 778.14501953125], 
[-27.41766357421875, -29.37322998046875, 1046.8123779296875, 781.18310546875], 
[1.631439208984375, 5.15838623046875, 1050.00390625, 779.547607421875], 
[73.80694580078125, 2.93414306640625, 953.0283203125, 778.2811889648438], 
[2.93133544921875, 6.7784423828125, 1051.915771484375, 781.1942138671875], 
[-18.6669921875, 1.266937255859375, 1036.5595703125, 770.6481323242188], 
]

imgfile = "F:\\datasets\\coco\\images\\val2017\\000000025139.jpg"  # 242
# imgfile = "F:\\datasets\\coco\\images\\val2017\\000000312340.jpg"  # 2709
line_width = 5
image = Image.open(imgfile)
image = image.resize((1197, 800))
img = ImageDraw.Draw(image)
savfile = "mla_50.jpg"
red = (255,50,215)
# red = (198,54,120)
green = (84, 255, 81)

for neg in neg_boxes:
    img.rectangle(((neg[0], neg[1]), (neg[2], neg[3])), fill=None, outline=green, width=line_width)

for pos in pos_boxes:
    img.rectangle(((pos[0], pos[1]), (pos[2], pos[3])), fill=None, outline=red, width=line_width)

image.save(savfile)